<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<head>
    <meta charset="utf-8" />
    <title>祈贝健康--后台管理系统</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
    <meta content="" name="description" />
    <meta content="" name="author" />

    <!-- ================== BEGIN BASE CSS STYLE ================== -->
    <link href="./Public/Admin/assets/plugins/jquery-ui/themes/base/minified/jquery-ui.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/animate.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/style.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/style-responsive.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/theme/default.css" rel="stylesheet" id="theme" />
    <!-- ================== END BASE CSS STYLE ================== -->

    <!-- ================== BEGIN PAGE LEVEL STYLE ================== -->
    <link href="./Public/Admin/assets/plugins/DataTables/css/data-table.css" rel="stylesheet" />
    <!-- ================== END PAGE LEVEL STYLE ================== -->

    <!-- ================== BEGIN BASE JS ================== -->
    <script src="./Public/Admin/assets/plugins/pace/pace.min.js"></script>
    <!-- ================== END BASE JS ================== -->
</head>
<body>
<php> include './Public/Admin/header.html'; </php>



<!-- begin #content -->
<div id="content" class="content">
    <!-- begin breadcrumb -->
    <ol class="breadcrumb pull-right">
        <li><a href="javascript:;">首页</a></li>
        <li><a href="javascript:;">月子中心管理</a></li>
        <li class="active">修改月子中心信息</li>

    </ol>
    <!-- end breadcrumb -->
    <!-- begin page-header -->
    <h1 class="page-header">月子中心管理 <small>修改月子中心信息</small></h1>
    <!-- end page-header -->

    <!-- begin row -->
    <div class="row">
        <!-- begin col-12 -->
        <div class="col-md-12">
            <!-- begin panel -->
            <div class="panel panel-inverse">
                <div class="panel-heading">
                    <div class="panel-heading-btn">
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-repeat"></i></a>
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger" data-click="panel-remove"><i class="fa fa-times"></i></a>
                    </div>
                    <h4 class="panel-title">修改月子中心信息</h4>
                </div>
                <div class="panel-body">
                    <div class="table-responsive">


                        <!--表单-->

                        <div class='col-md-10'>
                            <form class='form-horizontal' role='form'  method="post" action="index.php?m=Admin&c=CareCenter&a=lists&type=2" enctype="multipart/form-data">
                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'>月子中心Code：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="code" id='code' placeholder='请输入月子中心的Code信息' value="">
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'>月子中心名称：</label>
                                    <div class='col-md-4'>
                                        <textarea class="form-control" rows='3' name="name" id="name"  placeholder="请输入月子中心名称"></textarea>
                                    </div>
                                </div>

                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'>电话：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="telephone" id='telephone' placeholder='请输入电话'>
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'>地址：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="addr" id='addr' placeholder='请输入地址' value="">
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label' id="test">logo图：</label>
                                    <!--<div class='col-md-4'>-->
                                        <!--<input type="file" name="pics" id="pics"/>-->
                                    <!--</div>-->
                                </div>
                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'>月子中心简介：</label>
                                    <div class='col-md-4'>
                                        <textarea class="form-control" rows='3' name="introduce" id="introduce"  placeholder="请输入月子中心介绍"></textarea>
                                    </div>
                                </div>
                                <div class='form-group' id="addInput">
                                    <label for='inputtext' class='col-md-2 control-label'>月子中心形象图</label>
                                    <div class='col-md-4'>
                                        &nbsp;&nbsp;&nbsp;&nbsp;<a id="but" class="btn btn-primary">加</a>
                                    </div>

                                </div>
                                <div class='form-group' id="addImg">
                                    <label for='inputtext' class='col-md-2 control-label'></label>
                                </div>
                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'>是否是合作商家</label>
                                    <div class="col-lg-4">
                                        <div class="input-group">
                                        <span class="input-group-addon">
                                          <input  id="is_hz" type="checkbox" aria-label="..." name="is_hz" value="1">
                                         </span>
                                            <input type="text" class="form-control" value=" 合作商家请点选取按钮" aria-label="...">
                                        </div>
                                    </div>
                                </div>

                                <div class='form-group'>
                                    <div class='col-md-3 col-md-offset-2'>
                                        <button  class='btn btn-success btn-radius'>提交</button>
                                    </div>
                                </div>
                            </form>
                        </div>


                    </div>
                </div>
            </div>
            <!-- end panel -->
        </div>
        <!-- end col-12 -->
    </div>
    <!-- end row -->
</div>
<!-- end #content -->


<!-- begin scroll to top btn -->
<a href="javascript:;" class="btn btn-icon btn-circle btn-success btn-scroll-to-top fade" data-click="scroll-top"><i class="fa fa-angle-up"></i></a>
<!-- end scroll to top btn -->
<?php include './header.html'; ?>
<!-- end page container -->

<!-- ================== BEGIN BASE JS ================== -->
<script src="./Public/Admin/assets/plugins/jquery/jquery-1.9.1.min.js"></script>
<script src="./Public/Admin/assets/plugins/jquery/jquery-migrate-1.1.0.min.js"></script>
<script src="./Public/Admin/assets/plugins/jquery-ui/ui/minified/jquery-ui.min.js"></script>
<script src="./Public/Admin/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="./Public/Admin/assets/crossbrowserjs/html5shiv.js"></script>
<script src="./Public/Admin/assets/crossbrowserjs/respond.min.js"></script>
<script src="./Public/Admin/assets/crossbrowserjs/excanvas.min.js"></script>
<![endif]-->
<script src="./Public/Admin/assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- ================== END BASE JS ================== -->

<!-- ================== BEGIN PAGE LEVEL JS ================== -->
<script src="./Public/Admin/assets/plugins/DataTables/js/jquery.dataTables.js"></script>
<script src="./Public/Admin/assets/plugins/DataTables/js/dataTables.colVis.js"></script>
<script src="./Public/Admin/assets/js/apps.min.js"></script>
<!-- ================== END PAGE LEVEL JS ================== -->
<script>
    $(document).ready(function() {
        App.init();

        loadc();
    });
    var dataNum=0;//增加的条数
    function loadc(){
        $.getJSON("index.php?m=Admin&c=CareCenter&a=update_list",function(result){
            if(result!=0){
                $('#code').val(result.code);
                $('#name').val(result.name);
                $('#telephone').val(result.telephone);
                $('#addr').val(result.addr);
                $('#introduce').val(result.introduce);
                if(result.is_hz){
                    $("#is_hz").attr("checked","checked");
                }

                var picHtml=" ";
                    picHtml+= '<div id="pics" class="col-xs-6 col-md-2"><a href="#" class="thumbnail"><img src="./imageCareCenter/'+result.pics+'"></a>';
                    picHtml+='<div class="col-md-5">&nbsp;&nbsp;<div class="col-md-8"><a class="btn btn-success" id="updateLogo" onclick="update()" >删除</a></div>'
            }
            $("#test").after(picHtml);
        });

        //============================= 获取图片地址===========================================
        $.getJSON("index.php?m=Admin&c=CareCenter&a=get_imgs",function(result){
            if(result!=0){
                var getNum=result.length;
                dataNum=getNum;
                for(var i=0; i<getNum; i++){
                    var showHtml= '<div  class="form-group" id="imgs'+i+'">';
                    showHtml+="<label for='inputtext' class='col-md-2 control-label'></label>";
                    showHtml+= '<div  class="col-xs-6 col-md-2"><a href="#" class="thumbnail"><img  id="image'+i+'" src="./imageCareCenter_xx/'+result[i] +'"></a>';
                    showHtml+='<div class="col-md-5">&nbsp;&nbsp;<div class="col-md-8"><a class="btn btn-success" id="del'+i+'" onclick="del('+"'"+result[i]+"',"+i+')" >删除</a></div></div></div>';
                    $("#addImg").after(showHtml);
                }
            }
        });
    }


    //===================================增加图片上传表单=====================================
    $("#but").click(function(){
        if(dataNum<5){
            dataNum++;
            var newRow='<div  class="col-md-4 col-md-offset-2"><input type="file" name="imgs[]" id="inputImage'+dataNum+'"/></div>';
            newRow+='<div class="col-md-2"><a class="btn btn-success" id="inputDel'+dataNum+'" onclick="inputDel('+dataNum+')" >删除</a></div>';
            $("#addInput").after(newRow);
        }
    });
    //========================删除修改显示的图片===========================
    function del(obj,obj1){
        $.getJSON("index.php?m=Admin&c=CareCenter&a=update_imgs&imgNum="+obj,function(result){

            dataNum--;

            $("#imgs"+obj1).remove();

        });
    }
    //============================删除添加表单的==================================
    function inputDel(obj){
        dataNum--;
        $("#inputImage"+obj).remove();
        $("#inputDel"+obj).remove();
    }


    function update(){
        var picsHtml="<div  class='col-md-4' id='pics'>";
        picsHtml+= '<input type="file" name="pics" id="pics"/>';
        picsHtml += "</div>";
        $("#pics").html(picsHtml);

        //要考虑删除图片的逻辑
    }


</script>
</body>
</html>

